/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.evote.monitoreo.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mendoza
 */
@Entity
@Table(name = "candidato", catalog = "evote", schema = "")
@NamedQueries({
    @NamedQuery(name = "Candidato.findAll", query = "SELECT c FROM Candidato c"),
    @NamedQuery(name = "Candidato.findByIdCandidato", query = "SELECT c FROM Candidato c WHERE c.idCandidato = :idCandidato")})
public class Candidato implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idCandidato", nullable = false)
    private Integer idCandidato;
    @JoinColumn(name = "Ciudadano_idCiudadano", referencedColumnName = "idCiudadano", nullable = false)
    @ManyToOne(optional = false)
    private Ciudadano ciudadanoidCiudadano;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "candidatoidCandidato")
    private List<CandidatoPartidopolitico> candidatoPartidopoliticoList;

    public Candidato() {
    }

    public Candidato(Integer idCandidato) {
        this.idCandidato = idCandidato;
    }

    public Integer getIdCandidato() {
        return idCandidato;
    }

    public void setIdCandidato(Integer idCandidato) {
        this.idCandidato = idCandidato;
    }

    public Ciudadano getCiudadanoidCiudadano() {
        return ciudadanoidCiudadano;
    }

    public void setCiudadanoidCiudadano(Ciudadano ciudadanoidCiudadano) {
        this.ciudadanoidCiudadano = ciudadanoidCiudadano;
    }

    public List<CandidatoPartidopolitico> getCandidatoPartidopoliticoList() {
        return candidatoPartidopoliticoList;
    }

    public void setCandidatoPartidopoliticoList(List<CandidatoPartidopolitico> candidatoPartidopoliticoList) {
        this.candidatoPartidopoliticoList = candidatoPartidopoliticoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCandidato != null ? idCandidato.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Candidato)) {
            return false;
        }
        Candidato other = (Candidato) object;
        if ((this.idCandidato == null && other.idCandidato != null) || (this.idCandidato != null && !this.idCandidato.equals(other.idCandidato))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.evote.monitoreo.entity.Candidato[idCandidato=" + idCandidato + "]";
    }

}
